function query_reimburseManager(page) {
	sys_loading();
	var suc = '';
	$('#ptypeObjList').find('.pc').each(function () {
		suc += $(this).val() + ',';
	});
	if (suc.length > 0) {
		suc = suc.substring(0, suc.length - 1);
		var parm = $('#queryForm').serialize() + '&suc=' + suc + '&pageSize=10' + (page != null ? ('&page=' + page) : '');
	}else{
		var parm = $('#queryForm').serialize() + (page != null ? ('&page=' + page) : '');
	}
	var url = create_url('reimburseManager-query');
	sys_record_parm('reimburseManager',parm);
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#ResultList').html(result);
		}
	});
}



function selectedUser_reimburseManager(id,name) {
	var parm = {'id':id,'name':name};
	var url = create_url('reimburseManager-selectedUserInit');
	$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'800px', height: '700px', open:true});

}

function selectedUserList_reimburseManager(page) {
	var parm = $('#selectedUserForm').serialize() + sys_get_page(page);
	var url = create_url('reimburseManager-selectedUserList');
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#queryResultList').html(result);
		}
	});
}

function aidChoose_user(code, name){
	$("#auName").val(name);
	$("#au").val(code);
	$.fn.colorbox.close();
}


//点击查看完以后,修改确认状态
function updateDesignate1_reimburseManager(code) {
	var parm = {'code':code};
	var url = create_url('reimburseManager-updateDesignate1');
	$.ajax({type:'POST',url:url, data:parm,
		success:function (result) {
			sys_submiting_close();
			if (result == 'success') {
				sys_msg('操作成功!');
				sys_load_handle('reimburseManager');
			} else if (result == 'exists') {
				sys_msg('对不起！你已经审核过了！');
			} else if (result == 'error') {
				sys_msg('对不起! 你没有权限');
			} else if (result == 'parameter_error') {
				sys_msg('对不起! 上级还未审核');
			} else {
				sys_msg('操作失败!');
			}
		}
	});
}

function check_reimburseManager() {
	var remark = $('#remark').val();
	if (remark == null || remark == ''){
		$('#remark').css('border-color','red');
	}
}

//点击查看完以后,修改确认状态
function updateDesignate2_reimburseManager(code) {
	var remark = $('#remark').val();
	if (remark == null || remark == ''){
		sys_msg('亲，要说明驳回原因的哦！');
		return false;
	}
	var parm =  {'code':code, 'remark': remark};
	var url = create_url('reimburseManager-updateDesignate2');
	$.ajax({type:'POST',url:url, data:parm,
		success:function (result) {
				sys_submiting_close();
			if (result == 'success') {
				sys_msg('操作成功!');
				sys_load_handle('reimburseManager');
			} else if (result == 'exists') {
				sys_msg('对不起！已经审核过了！');
			} else if (result == 'error') {
				sys_msg('对不起! 你没有权限');
			} else if (result == 'parameter_error') {
				sys_msg('对不起! 上级还未审核');
			} else {
				sys_msg('操作失败!');
			}
		}
	});
}

//选择用户
function selectUser_reimburseManager() {
	var a = '';
	$('#ptypeObjList').find('input.pc').each(function () {
		a += $(this).val() + ',';
	});
	if (a.length > 0) {
		a = a.substring(0, a.length - 1);
	}
	var parm = {'a':a};
	var url = create_url("reimburseManager-aidInit");
	$.colorbox({overlayClose:false, href:url,data:parm, close:'[关闭]', width:'1000px', height:'700px', open:true});
}

function aidQueryUser_reimburseManager(page) {
	var oldoc = $('#old_oc').val();
	var suc = '';
	$('#selectedListBody').find('.run').each(function () {
		suc += $(this).val() + ',';
	});
	suc += oldoc;
	if (suc.length > 0 && oldoc.length == 0) {
		suc = suc.substring(0, suc.length - 1);
	}
	var parm = $('#aidQueryForm').serialize() + '&suc=' + suc + '&pageSize=10' + (page != null ? ('&page=' + page) : '');
	var url = create_url('reimburseManager-aidList');
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#aidQueryResultList').html(result);
		}
	});
}




function addUser_reimburseManager(code, project) {
	var tr = $('#tempTable').find('.rep').clone(true);
	tr.find('.rn').html(project).end()
		.find('.run').val(code).end()
		.find('.un').val(project).end()
	$('#selectedListBody').append(tr);
	aidQueryUser_reimburseManager($('#aidQueryUserPageTxt').val());
}

function chooseUser_reimburseManager() {
		var template = $('#tempListDiv').find('.rep');
		var ListTd = $('#ptypeObjList');
		var i = 0;
		$('#selectedListBody').find('.rep').each(function () {
			var rep = template.clone(true);
			rep.find('.title').html($(this).find('.un').val()).end()
				.find(".pc").attr({"name" : "list["  + i + "].pc", "value":$(this).find('.run').val()}).end()
				.find('.ucs').attr({'project':"list["  + i + "].mc"}).end();
			ListTd.append(rep);
			i++;
		});
		$.fn.colorbox.close();
	}

function deleteUser_reimburseManager(btn) {
	btn.parents('.rep').remove();
	aidQueryUser_reimburseManager($('#aidQueryUserPageTxt').val());
}

function delete_reimburseManager(btn, i) {
	btn.parents('.rep').remove();
}